#pragma once

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>

#define LINE_SIZE 1024
#define FFLUSH_NOW  1
#define FFLUSH_LINE 2
#define FFLUSH_FULL 4

typedef struct my_FILE
{
    unsigned int flags;
    int fileno;
    char cache[LINE_SIZE];
    int cap;
    int pos;//下次写入的位置
}my_FILE;

my_FILE* my_fopen(const char* path, const char* flag);
ssize_t my_fwrite(my_FILE* fp, const char* data, int len);
void my_fflush(my_FILE* fp);
void my_fclose(my_FILE* fp);
